package com.learn.springcloud.zuulquickstartconsumer.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @Time : 2018/8/9 11:50
 * @Version : 1.0
 */
@RestController
public class HelloController {

    @Autowired
    private RestTemplate restTemplate;

    @RequestMapping(value = "/zuul/quick/start/consumer/test1/{name}")
    public String test1(@PathVariable String name){
        System.out.println(name);
        String url = "http://zuul-quick-start-provider/zuul/quick/start/provider/test1/{1}";
        return restTemplate.getForObject(url,String.class,name);
    }
}
